//
//  LMAccount.m
//  李明微博
//
//  Created by 张青花 on 15/12/8.
//  Copyright (c) 2015年 李明. All rights reserved.
//

#import "LMAccount.h"
#import "MJExtension.h"

#define  LMremind_in @"remind_in"
#define  LMaccess_token @"access_token"
#define  LMexpires_in @"expires_in"
#define  LMuid @"uid"
#define  LMexpires_date @"expires_date"

@implementation LMAccount


MJCodingImplementation

+ (instancetype)initWithAccount:(NSDictionary *)dictinary
{
    LMAccount *account = [[LMAccount alloc] init];
    [account setValuesForKeysWithDictionary:dictinary];
    return account;
}

- (void)setExpires_in:(NSString *)expires_in
{
    _expires_in = expires_in;
    
    _expires_date = [NSDate dateWithTimeIntervalSinceNow:[expires_in longLongValue]];
}


//- (id)initWithCoder:(NSCoder *)aDecoder
//{
//    if (self == [super init]) {
//        self.access_token = [aDecoder decodeObjectForKey:LMaccess_token];
//        self.remind_in = [aDecoder decodeObjectForKey:LMremind_in];
//        self.expires_in = [aDecoder decodeObjectForKey:LMexpires_in];
//        self.uid = [aDecoder decodeObjectForKey:LMuid];
//        self.expires_date = [aDecoder decodeObjectForKey:LMexpires_date];
//    }
//    return self;
//}
//
//- (void)encodeWithCoder:(NSCoder *)aCoder
//{
//    [aCoder encodeObject:self.access_token forKey:LMaccess_token];
//    [aCoder encodeObject:self.remind_in forKey:LMremind_in];
//    [aCoder encodeObject:self.expires_in forKey:LMexpires_in];
//    [aCoder encodeObject:self.uid forKey:LMuid];
//    [aCoder encodeObject:self.expires_date forKey:LMexpires_date];
//}
@end
